﻿Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Windows.Media.Animation
Imports System.Threading
Imports VsSpeakerCompanion.UI

Namespace VsSpeakerCompanion.UI
    Partial Public Class LoginWindow
        Inherits Window
        Friend Sub New()
            InitializeComponent()
        End Sub

        Private Sub CloseWindowAnimationCompleted(ByVal sender As Object, ByVal e As EventArgs)
            Me.Close()
        End Sub

        Friend Sub CloseWithAnimation()
            Me.BeginStoryboard(TryCast(Me.FindResource("CloseWindowAnimation"), Storyboard))
        End Sub

        ''' <summary>
        ''' Overrides KeyUp to handle the Escape key
        ''' </summary>
        ''' <param name="e"></param>
        Protected Overrides Sub OnKeyUp(ByVal e As KeyEventArgs)
            MyBase.OnKeyUp(e)

            If e.Key = Key.Escape Then
                CloseWithAnimation()
                e.Handled = True
            End If
        End Sub
    End Class
End Namespace